package com.alianzamedica.view;

import org.apache.struts.action.ActionForm;
import org.objectsearch.web.tools.Converter;

import com.alianzamedica.businessobject.Profile;

/**
 * @author Carlos
 * 
 */
public class ProfileSaveForm extends ActionForm {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1160106572388429832L;

	private String id;
	private String name;

	/**
	 * id.
	 * 
	 * @return id.
	 */
	public String getId() {
		return id;
	}

	/**
	 * id.
	 * 
	 * @param id
	 *            id.
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * nombre.
	 * 
	 * @return nombre.
	 */
	public String getName() {
		return name;
	}

	/**
	 * nombre.
	 * 
	 * @param name
	 *            nombre.
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * obtiene el perfil del objeto.
	 * 
	 * @return el perfil del objeto.
	 */
	public Profile getObjectProfile() {
		Profile profile = new Profile();
		profile.setId(Converter.string2Integer(id));
		profile.setName(name);
		return profile;
	}

	/*
	 * @Override public ActionErrors validate(ActionMapping mapping,
	 * HttpServletRequest request) { ActionErrors errors = new ActionErrors();
	 * ValidateTool validateTool = new ValidateTool(); if(
	 * validateTool.isStringEmpty(name) ){ errors.add("name", new
	 * ActionMessage("name es requerido")); } if( errors.size() > 0 ){
	 * request.setAttribute("errors", errors); Profile profile =
	 * this.getObjectProfile(); request.setAttribute("profile", profile); }
	 * 
	 * 
	 * return errors; }
	 */

}
